﻿using System;
using System.Text;
using System.Security.Cryptography;

namespace Abs.Core.Util
{
    public static class Sha512
    {
        //Return the hash value in hexadecimal string format
        public static string Hashing(string data)
        {
            var utf32Encoding = new UTF32Encoding();
            var byteData = utf32Encoding.GetBytes(data);
            var sha512 = new SHA512Managed();
            var results = sha512.ComputeHash(byteData);
            var stringBuilder = new StringBuilder();

            foreach (var result in results)
                stringBuilder.Append(result.ToString("x2"));

            return stringBuilder.ToString();
        }//end of public static bool Hashing(string data)
    }//end of public class Sha512
}//end of namespace ABS.Util